﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Labaratornaya1
{
    internal class Person
    {
        private string name;
        private string surname;
        private DateTime birthday;

        public string Name
        {
            get { return name; }
            set
            {
                if (value != "")
                    name = value;
                else Console.WriteLine("Вы ничего не ввели!");
            }
        }

        public string Surname
        {
            get { return surname; }
            set
            {
                if (value != "")
                    surname = value;
                else Console.WriteLine("Вы ничего не ввели!");
            }
        }

        public DateTime Birthday
        {
            get
            {
                return birthday.Date;
            }
            set
            {
               // DateTime tempBDate = new DateTime(1994,11,27);
               // if (value is DateTime)
              //  tempBDate = value;
                birthday = value;                
            }
        }

        public int BYear
        {
            get
            {
                return birthday.Year;
            }
            set
            {
                DateTime tempBDate = new DateTime(value, birthday.Month, Birthday.Day);
                birthday = tempBDate;
                Console.WriteLine("Новый год рождения: {0}", birthday.Year);
                Console.WriteLine("Дата рождения: {0}.{1}.{2}", birthday.Day, birthday.Month, birthday.Year);
            }
        }        

        public Person()
        {
            name = "Кирилл";
            surname = "Муха";
            birthday = new DateTime(1994, 11, 27);
        }
        public Person(string name, string surname, DateTime birthday)
        {
            this.name = name;
            this.surname = surname;
            this.birthday = birthday;
        }
        public void IntroduceYourSelf()
        {
            Console.WriteLine("Имя: {0}. Фамилия: {1}. Дата рождения: {2}.{3}.{4}", name, surname, birthday.Day, birthday.Month, birthday.Year);
        }

        public override string ToString()
        {
            return String.Format("Имя:{0} Фамилия:{1} Дата рождения:{2}.{3}.{4}", name, surname, birthday.Day, birthday.Month, birthday.Year);
        }
        public virtual string ToShortString()
        {
            return String.Format("Имя:{0} Фамилия:{1}", name, surname);
        }
    }
}
